package de.nordakademie.hausarbeit.validation;

import org.eclipse.xtext.validation.Check;

import de.nordakademie.hausarbeit.stylesheet.Body;
import de.nordakademie.hausarbeit.stylesheet.Header;
import de.nordakademie.hausarbeit.stylesheet.Rule;
import de.nordakademie.hausarbeit.stylesheet.Stylesheet;
import de.nordakademie.hausarbeit.stylesheet.StylesheetPackage;
import de.nordakademie.hausarbeit.stylesheet.Title;


 

public class StylesheetJavaValidator extends AbstractStylesheetJavaValidator {

	/* =======================================
	 * Some validation rules for the stylesheet DSL
	 *========================================/

	/*
	 * validate that a rule starts with lower case
	 */
	@Check
	public void checkBodyRuleNameStartsWithCapital(Body body) {
		if (!Character.isLowerCase(body.getName().charAt(0))) {
			error("Rule name should start with lower case letters", StylesheetPackage.Literals.BODY__NAME);
		}
	}

	@Check
	public void checkHeaderRuleNameStartsWithCapital(Title title) {
		if (!Character.isLowerCase(title.getName().charAt(0))) {
			error("Rule name should start with lower case letters", StylesheetPackage.Literals.TITLE__NAME);
		}
	}

	
}
